package com.goahead.springjustknow;

import com.goahead.springjustknow.initializer.EnvConfigDecryptInitializer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Slf4j
public class SpringJustKnowApplication implements CommandLineRunner {

  public static void main(String[] args) {
    // 不推荐，仅仅为了演示addInitializers用法
    SpringApplication application = new SpringApplication(SpringJustKnowApplication.class);
    application.addInitializers(new EnvConfigDecryptInitializer());
    application.run(args);

    // 还是推荐下边这个spring脚手架生成的代码，简洁
    // SpringApplication.run(SpringJustKnowApplication.class, args);
  }

  @Override
  public void run(String... args) throws Exception {
    log.info("do something after application started, implement by CommandLineRunner");
  }

}
